package demo7;

import javax.print.DocFlavor;
import java.util.Set;
import java.util.TreeSet;

public class test1 {
    public static void main(String[] args) {
        Set<Integer>  set = new TreeSet<>();
        set.add(1);
        set.add(2);
        set.add(5);
        set.add(2);
        while(set.iterator().hasNext()) {
            System.out.println(set.iterator().next());
        }
        System.out.println(set);
    }
}
